package com.fpd;

//import com.fpd.netty.MessageServer;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication // - springboot项目,并配置扫描路径
@EnableTransactionManagement
@EnableCaching
@EnableAsync
//@EnableAutoConfiguration // - springboot自动配置，这个注解可以根据你依赖的包自动生成相关配置
public class SpringApp extends SpringBootServletInitializer
		//implements CommandLineRunner
{

	// 注入bean，手动配置临时目录
//	@Bean
//	MultipartConfigElement multipartConfigElement() {
//		MultipartConfigFactory factory = new MultipartConfigFactory(); // 设置路径xxx
//		factory.setLocation("/tmp/tomcat");
//		return factory.createMultipartConfig();;
//	} ，

	public static void main(String[] args) {
		SpringApplication springApplication = new SpringApplication(SpringApp.class);
		// Banner.Mode.OFF 关闭
		springApplication.setBannerMode(Banner.Mode.CONSOLE);
		springApplication.run(args);
	}

	/**
	 * 需要把web项目打成war包部署到外部tomcat运行时需要改变启动方式
	 */
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(SpringApp.class);
	}

}
